package com.smartleanx.module.hrm.service.esign.temp.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;

@Data
public class SignFlowCreateVo {

    @Schema(description = "待签署文件信息")
    private List<DocItem> docs;

    @Schema(description = "签署流程配置项")
    private SignFlowConfig signFlowConfig;

    @Schema(description = "签署方信息")
    private List<SignerItem> signers;


    @Data
    public static class DocItem {
        @Schema(description = "待签署文件ID")
        private String fileId;

        @Schema(description = "文件名称")
        private String fileName;

    }

    @Data
    public static class SignFlowConfig {
        @Schema(description = "签署流程主题")
        private String signFlowTitle;

        @Schema(description = "签署截止时间")
        private long signFlowExpireTime;

        @Schema(description = "自动完结")
        private boolean autoFinish;

        @Schema(description = "回调通知")
        private String notifyUrl;

        @Schema(description = "流程整体通知配置项")
        private NoticeConfig noticeConfig;

        @Schema(description = "重定向配置项")
        private RedirectConfig redirectConfig;

        @Schema(description = "签署配置项")
        private SignConfig signConfig;


        @Data
        public static class SignConfig {
            @Schema(description = "签署终端类型，默认值：1,2（英文逗号分隔）")
            private String availableSignClientTypes;
        }

        @Data
        public class NoticeConfig {
            @Schema(description = "通知类型")
            private String noticeTypes;

            @Schema(description = "审批人员的通知类型")
            private String examineNotice;

        }

        @Data
        public class RedirectConfig {
            @Schema(description = "重定向地址")
            private String redirectUrl;

        }
    }


    @Data
    public static class SignerItem {
        @Schema(description = "签署人配置项")
        private SignConfig signConfig;

        @Schema(description = "签署方类型")
        private int signerType;

        @Schema(description = "企业签署方信息")
        private OrgSignerInfo orgSignerInfo;

        @Schema(description = "签署方信息")
        private PsnSignerInfo psnSignerInfo;

        @Schema(description = "签署区信息")
        private List<SignFields> signFields;


        @Data
        public static class SignConfig {
            @Schema(description = "设置页面强制阅读倒计时时间")
            private int forcedReadingTime;

            @Schema(description = "签署顺序")
            private int signOrder;

        }

        @Data
        public static class OrgSignerInfo {
            @Schema(description = "企业/机构名称")
            private String orgName;

            @Schema(description = "签署顺序")
            private int signOrder;

            @Schema(description = "企业/机构签署方信息")
            private OrgInfo orgInfo;

            @Schema(description = "企业/机构经办人信息")
            private TransactorInfo transactorInfo;

            @Data
            public class OrgInfo {
                @Schema(description = "企业/机构证件号")
                private String orgIDCardNum;

                @Schema(description = "企业/机构证件类型")
                private String orgIDCardType;

            }

            @Data
            public static class TransactorInfo {
                @Schema(description = "经办人账号标识，手机号或邮箱")
                private String psnAccount;

                @Schema(description = "经办人身份信息")
                private PsnInfo psnInfo;

                @Data
                public static class PsnInfo {
                    @Schema(description = "经办人姓名")
                    private String psnName;

                    @Schema(description = "经办人证件号")
                    private String psnIDCardNum;

                    @Schema(description = "经办人证件类型")
                    private String psnIDCardType;
                }

            }
        }

        @Data
        public static class PsnSignerInfo {
            @Schema(description = "个人账号标识")
            private String psnAccount;

            @Schema(description = "个人签署方身份信息")
            private PsnInfo psnInfo;

            @Data
            public static class PsnInfo {
                @Schema(description = "个人姓名")
                private String psnName;

                @Schema(description = "个人证件号")
                private String psnIDCardNum;

                @Schema(description = "个人证件类型")
                private String psnIDCardType;

            }
        }

        @Data
        public static class SignFields {
            @Schema(description = "签署区所在待签署文件ID")
            private String fileId;

            @Schema(description = "开发者自定义业务编号")
            private String customBizNum;

//            @Schema(description = "签署区类型")
//            private Integer signFieldType;

            @Schema(description = "签章区配置项")
            private NormalSignFieldConfig normalSignFieldConfig;

            @Data
            public static class NormalSignFieldConfig {
                @Schema(description = "是否自由签章")
                private boolean freeMode;

                @Schema(description = "是否后台自动落章")
                private boolean autoSign;

                @Schema(description = "指定印章ID")
                private String assignedSealId;

                @Schema(description = "签章区样式")
                private int signFieldStyle;

                @Schema(description = "签章区位置信息")
                private SignFieldPosition signFieldPosition;

                @Data
                public static class SignFieldPosition {
                    @Schema(description = "骑缝章模式选择")
                    private String acrossPageMode;

                    @Schema(description = "签章区所在页码")
                    private Integer positionPage;

                    @Schema(description = "签章区所在X坐标")
                    private float positionX;

                    @Schema(description = "签章区所在Y坐标")
                    private float positionY;

                }

            }
        }

    }




}
